package dao

import "miao-wails/backed/structs/tables"

var IdpDao = new(idpDao)

type idpDao struct {
}

// FindLogsForAck2 查询未上传的日志
func (d idpDao) FindLogsForAck2() (li []tables.CollectInfo, err error) {
	err = IdpDb.Model(&tables.CollectInfo{}).Where("ack = 2").Find(&li).Error
	return
}

func (d idpDao) FindLogsForTime(startTime int64, endTime int64) (li []tables.CollectInfo, err error) {
	err = IdpDb.Model(&tables.CollectInfo{}).
		Where("create_at >=? AND create_at <=?", startTime, endTime).
		Find(&li).Error
	return
}

func (d idpDao) FindPolicyList() (li []tables.Policy, err error) {
	err = IdpDb.Model(&tables.Policy{}).Find(&li).Error
	return
}
